import ajax from '@/utils/request'
import { concatUrl } from '@/utils'

// 创建评价
export function create(data, fields: string | object = { fields: '*' }) {
    return ajax({
        url: concatUrl('/v1/order/order-goods-comment/create', fields),
        data,
        method: 'POST'
    })
}

// 评价列表
export function getList(data = {}, fields: string | object = { fields: '*' }) {
    return ajax({
        url: concatUrl('/v1/order/order-goods-comment/index', fields),
        data
    })
}

// 评价商品列表
export function getEvaluateGoodsList(data = {}, fields: string | object = { fields: '*' }) {
    return ajax({
        url: concatUrl('/v1/order/order-goods-comment/post', fields),
        data,
        method: 'GET'
    })
}

// 评价最新一条
export function getLatest(data = {}, fields: string | object = { fields: '*' }) {
  return ajax({
      url: concatUrl('/v1/order/order-goods-comment/latest', fields),
      data
  })
}

// 评价总条数
export function getTotal(data = {}, fields: string | object = { fields: '*' }) {
    return ajax({
        url: concatUrl('/v1/order/order-goods-comment/comment-total', fields),
        data
    })
}
